package com.fresh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fresh.entity.Pay;
import com.fresh.entity.PayQO;
import com.fresh.mapper.YingFuKuanMapper;
import com.fresh.service.YingFuKuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YingFuKuanServiceImpl implements YingFuKuanService {
    @Autowired
    YingFuKuanMapper yingFuKuanMapper;

    @Override
    public PageInfo<Pay> findPageInfoByCondition(PayQO payQO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Pay> pays = yingFuKuanMapper.findPageInfoByCondition(payQO);
        PageInfo<Pay> pageInfo = new PageInfo<>(pays);
        return pageInfo;
    }

    @Override
    public void add(Pay pay) {
        yingFuKuanMapper.insert(pay);
    }

    @Override
    public void pay(Pay pay) {
        yingFuKuanMapper.update(pay);
    }

}
